﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using Evaluation3.utils;

/// <summary>
/// Các thao tác với Sản phẩm của một doanh nghiệp
/// </summary>
public class sanphamService
{
    #region Khai báo biến
    int iMaSanPham;
    string sTenSanPham;
    string sKyThuatSanXuat;
    string sThiTruong;
    string sTieuChuanSanPham;
    string sNamSanXuat;
    int iMaDoanhNghiep;
    int iMaHoiDong;
    bool bStatus;

    string sqlStr;
    SqlParameter[] parr;
    #endregion

    #region Các thuộc tính
    public int MaSanPham { get { return iMaSanPham; } set { iMaSanPham = value; } }
    public string TenSanPham { get { return sTenSanPham; } set { sTenSanPham = value; } }
    public string KyThuatSanXuat { get { return sKyThuatSanXuat; } set { sKyThuatSanXuat = value; } }
    public string ThiTruong { get { return sThiTruong; } set { sThiTruong = value; } }
    public string TieuChuanSanPham { get { return sTieuChuanSanPham; } set { sTieuChuanSanPham = value; } }
    public string NamSanXuat { get { return sNamSanXuat; } set { sNamSanXuat = value; } }
    public int MaDoanhNghiep { get { return iMaDoanhNghiep; } set { iMaDoanhNghiep = value; } }
    public int MaHoiDong { get { return iMaHoiDong; } set { iMaHoiDong = value; } }
    public bool Status { get { return bStatus; } set { bStatus = value; } }


    #endregion

    #region Constructor
    public sanphamService()
    {
        iMaSanPham = 0;
        sTenSanPham = string.Empty;
        sKyThuatSanXuat = string.Empty;
        sThiTruong = string.Empty;
        sTieuChuanSanPham = string.Empty;
        sNamSanXuat = string.Empty;
        iMaDoanhNghiep = 0;
        iMaHoiDong = 0;
        bStatus = true;
    } 
    #endregion

    #region Methods

    #region SP_New()
    public void SP_New()
    {
        sqlStr = "TaoMoiSanPham_PROC";
        parr = new SqlParameter[7];

        parr[0] = new SqlParameter("@TenSanPham", SqlDbType.NVarChar, 200);
        parr[0].Value = TenSanPham;
        parr[1] = new SqlParameter("@MaDoanhNghiep", SqlDbType.Int);
        parr[1].Value = MaDoanhNghiep;
        parr[2] = new SqlParameter("@KyThuatSanXuat", SqlDbType.NVarChar,100);
        parr[2].Value = KyThuatSanXuat;
        parr[3] = new SqlParameter("@ThiTruong", SqlDbType.NVarChar,100);
        parr[3].Value = ThiTruong;
        parr[4] = new SqlParameter("@TieuChuanSanPham", SqlDbType.NVarChar, 100);
        parr[4].Value = TieuChuanSanPham;
        parr[5] = new SqlParameter("@NamSanXuat", SqlDbType.VarChar,4);
        parr[5].Value = NamSanXuat;
        parr[6] = new SqlParameter("@MaHoiDong", SqlDbType.Int);
        parr[6].Value = MaHoiDong;

        dataUtils.ExecuteNonQuery(sqlStr, CommandType.StoredProcedure, parr);

    }
    #endregion

    #endregion
}
